

/*
* Metafile for zip-code level analysis
*/


* define globals
global root ".."
global code "${root}/code"
global data_raw "${root}/data/raw"
global data_raw_covs "${data_raw}/covariates"
global data_raw_cases "${data_raw}/cases"
global data_raw_poi "${data_raw}/safegraph/places"
global data_raw_weekly_places "${data_raw}/safegraph/weekly place patterns"
global data_raw_sd "${data_raw}/safegraph/social distancing"
global data_raw_geo "${data_raw}/geo"
global data_raw_sci "${data_raw}/SCI"
global data_derived "${root}/data/derived"
cap mkdir "${data_derived}"
global data_derived_covs "${data_derived}/covariates"
cap mkdir "${data_derived_covs}"
global data_derived_cases "${data_derived}/cases"
cap mkdir "${data_derived_cases}"
global data_derived_sd "${data_derived}/social distancing"
cap mkdir "${data_derived_sd}"
global data_derived_poi "${data_derived}/poi"
cap mkdir "${data_derived_poi}"
global data_derived_sci "${data_derived}/SCI"
cap mkdir "${data_derived_sci}"
global data_derived_exposure "${data_derived}/exposure"
cap mkdir "${data_derived_exposure}"
global plots "${root}/plots"
cap mkdir "${plots}"
global tables "${root}/tables"
cap mkdir "${tables}"

* ++++++++++++++++++++++
* CLEANING
* ++++++++++++++++++++++

* clean covariates (e.g. control variables)
do "${code}/cleaning/clean_covariates.do"

* number of COVID-19 cases
do "${code}/cleaning/clean_number_of_cases.do"

* Safegraph social distancing data
do "${code}/cleaning/clean_safegraph_social_distancing.do"

* Safegraph POI visit data
do "${code}/cleaning/clean_safegraph_POI_visits.do"

* collapse zip-zip SCI  to zip-county level 
do "${code}/cleaning/zip_to_cty_sci.do"

* calculate SCI weighted exposure to COVID-19
do "${code}/cleaning/sci_weighted_exposure.do"

* rank zips based on SCI weighted exposure to COVID-19
do "${code}/cleaning/rank_zips_covid_exposure.do"

* combine various Safegraph data products with SCI weighted covid data + covariates
* to make regression dataset
do "${code}/cleaning/combine_safegraph.do"


* ++++++++++++++++++++++
* ANALYSIS
* ++++++++++++++++++++++	
	
* add analysis stuff
do "${code}/analysis/zip_lvl_anaylsis.do"

* plots 
do "${code}/analysis/plots_zip_lvl_analysis.do"
